import _thread
import time
import threading

class Persion(object):
    def __inif__(self):
        self.name = '小王'

    def __new__(self):
        if not hasattr(Persion,'instance'):
            print("实例化__new__")
            time.sleep(4)
            Persion.instance = object.__new__(self);
        return Persion.instance;
   



class persionDemo(threading.Thread):
    def __init__(self, threadID, name, counter):
        threading.Thread.__init__(self)
        self.threadID = threadID
        self.name = name
        self.counter = counter

    def run(self):
        print ("开始线程：" + self.name)
        p = Persion();
        print('p:::',p)
        print ("退出线程：" + self.name)


if __name__ == '__main__':
    print('__main__')
    threadlist = [];
    for x in range(10):
        threadlist.append(persionDemo(x,x,x))
        
    for x in threadlist:
        x.start()
    
    for x in threadlist:
        x.join()

    print('执行完成')

